package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.DiseaseBean;
import com.project.service.IDiseaseService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author RJ
 * @date 2022/9/16 9:33
 */
@RestController
@RequestMapping("disease")
public class DiseaseController {
    @Resource
    private IDiseaseService diseaseService;

    @RequestMapping("add")
    public String addDisease(DiseaseBean diseaseBean) {
        diseaseService.addDisease(diseaseBean);
        return "ok";
    }

    @RequestMapping("get")
    public DiseaseBean getDiseaseInfo(Integer diseaseId) {
        DiseaseBean diseaseBean = diseaseService.getDiseaseInfo(diseaseId);
        return diseaseBean;
    }

    @RequestMapping("info")
    public IPage<DiseaseBean> cutDiseaseByItem(Integer pageNo, Integer pageSize, String diseaseName, String diseaseSymptoms) {
        IPage<DiseaseBean> page = diseaseService.cutDiseaseByItem(pageNo, pageSize, diseaseName, diseaseSymptoms);
        return page;
    }
}
